﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;

namespace Wala.Common.Contacts
{
    public class RetContactBasic
    {
        private List<ContactBasic> userBasics;

        public List<ContactBasic> User_basics
        {
            get { return userBasics; }
            set { userBasics = value; }
        }
        
        public RetContactBasic()
        {
            userBasics = new List<ContactBasic>();
        }

        public RetContactBasic(List<ContactBasic> userBasics)
        {
            this.userBasics = userBasics;
        }

        //don't use this method because adding Status property in ContactBasic by lee :D
        public static RetContactBasic FromJson(string json)
        {
            try
            {
                RetContactBasic retContactBasic = JsonConvert.DeserializeObject<RetContactBasic>(json);
                List<ContactBasic> lstContact = retContactBasic.User_basics;
                return new RetContactBasic(lstContact);
            }
            catch
            {
                return new RetContactBasic();
            }
        }
    }
}
